package com.demo.config;

import com.demo.intercept.LoginHandlerInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author : liuf
 * @version V1.0
 * @title: LoginConfig
 * @date 2021年11月19日 17:49
 **/
@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册自己的拦截器并设置拦截的请求路径
        registry.addInterceptor(new LoginHandlerInterceptor())
                .addPathPatterns("/**"); //拦截的路径

    }
}
